<template>
	<view>
		<!-- <uni-section title="实心标签" type="line"> -->
		<view class="uni-padding-wrap uni-common-mt">
			<uni-segmented-control :current="current" :values="items" :style-type="styleType"
				:active-color="activeColor" @clickItem="onClickItem" />
		</view>
		<view class="uni-box1" v-if="current === 0" v-for="item in resultwc">
			<view>
				<navigator @click="order(item.roId)">
					<text class="content-text">订单编号：{{item.number}}</text>

					<view class="img">

						<img class="location" src="/static/img/location.png">

						<text class="content-text-location-font">{{item.address}}</text>
					</view>

					<!-- <view class="img">
						<img class="time" src="/static/img/time.png">
						<text class="content-text-location-font">上门时间：{{item.getTime}}</text>
					</view> -->
					<view class="img">
						<text class="content-text-location-font">{{item.contactsName}}&nbsp&nbsp{{item.phone}}</text>
					</view>
					<view class="img">
						<text class="content-text-location-font">订单完成时间：
							<view class="djs">
								{{item.updateTime}}
							</view>

						</text>
					</view>
					<view>
						<img class="recovery" src="/static/img/seal.png">
					</view>
				</navigator>
			</view>
		</view>
		<view class="uni-box2" v-if="current === 1" v-for="item in resultcommodity">

			<view>
				<navigator @click="order(item.roId,item.roType)">
					<text class="content-text">订单编号：{{item.number}}</text>
					<view class="img">
						<img class="location" src="/static/img/location.png">
						<text class="content-text-location-font">{{item.address}}</text>
					</view>

					<view class="img">
						<text class="content-text-location-font">{{item.contactsName}}&nbsp &nbsp{{item.phone}}</text>
					</view>
					<view class="img">
						<text class="content-text-location-font">订单完成时间
							<view class="djs">
								{{item.updateTime}}
							</view>
						</text>
					</view>
					<view>
						<img class="recovery" src="/static/img/seal.png">
					</view>
				</navigator>

			</view>
		</view>


		<view>
			<text class="font">没有更多内容</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				items: ['回收订单', '送货订单'],
				// colors: ['#007aff', '#4cd964', '#dd524d'],
				current: 0,
				colorIndex: 0,
				activeColor: '#4cd964',
				styleType: 'text',
				a: 1,
				resultwc: {},
				resultcommodity: {}
			}
		},
		onLoad() {
			this.loadData()
		},
		methods: {
			order(roId , roType) {
				console.log(roId)
				// console.log(roType)
				uni.navigateTo({
					url:'../details/OrderCompletionDetails?roId=' + roId
				})
			},
			loadData() {
				uni.getStorage({
					key: 'userid',
					success: res => {
						this.userid = res.data
						console.log("zaizhe", this.userid)
					}
				})
				uni.request({
					url: 'http://localhost:9525/xkrider/recyclingorder/getRecyclingorderCompleted',
					method: 'GET',
					data: {
						riderId:this.userid
					},
					dataType: 'json',
					success: (res) => {
						// var result = JSON.parse(res.data.data.message);
						this.resultwc = res.data.data.recyclingorderVo;
						console.log(this.resultwc)
					},
				})
			},
			onClickItem(e) {
				if (this.current !== e.currentIndex) {
					this.current = e.currentIndex
				}
				uni.getStorage({
					key: 'userid',
					success: res => {
						this.userid = res.data
						console.log("zaizhe", this.userid)
					}
				})
				uni.request({
					url: 'http://localhost:9525/xkrider/commodityorder/getCommodityorder',
					method: 'GET',
					data: {
						riderId:this.userid,
						coType: 4
					},
					dataType: 'json',
					success: (res) => {
						// var result = JSON.parse(res.data.data.message);
						this.resultcommodity = res.data.data.commodityorderVoList;
						console.log(this.resultcommodity)
					},
				})
			},

		}
	}
</script>

<style lang="scss">
	.recovery {
		width: 100rpx;
		height: 100rpx;
		float: right;
	}

	.djs {
		float: right;

	}

	.times {
		@include flex;
		align-items: center;

		&__item {
			color: #fff;
			font-size: 12px;
			text-align: center;
		}
	}

	.font {
		display: flex;
		justify-content: center;
		color: #CCCCCC;
	}

	page {
		background-color: #EBFCF9;
		font-weight: bold;
	}

	.img {
		margin-top: 20rpx;
	}

	.content-text-location-font {
		margin-left: 15rpx;
		font-size: 14px;
		color: #666;
	}

	.time {
		width: 43rpx;
		height: 43rpx;
		// margin-top: 15rpx;
		margin-left: 15rpx;
		float: left;

	}

	.location {
		width: 45rpx;
		height: 45rpx;
		// margin-top: 15rpx;
		margin-left: 15rpx;
		float: left;
		;
	}

	.uni-padding-wrap {
		// width: 750rpx;
		padding: 0px 30px;
	}

	.uni-box1 {
		width: 600rpx;
		height: 330rpx;
		border-radius: 7px;
		// border: 1px solid #3F536E;
		padding: 10px;
		margin: 50rpx auto;
		box-shadow: darkgrey 3px 3px 3px 3px;
		// position: absolute;
		// left: 25rpx;
		background-color: #FFFFFF;

	}

	.uni-box2 {
		width: 600rpx;
		height: 330rpx;
		border-radius: 7px;
		// border: 1px solid #3F536E;
		padding: 10px;
		margin: 50rpx auto;
		box-shadow: darkgrey 3px 3px 3px 3px;
		// position: absolute;
		// left: 25rpx;
		background-color: #FFFFFF;

	}

	.button-yuanjiao {
		width: 150rpx;
		height: 50rpx;
		display: flex;
		// margin-top: 0rpx;
		// margin-left: 420rpx;
		line-height: 50rpx;
		justify-content: center;
		border-radius: 25px;
		// 这里可以改成渐变： 
		background: linear-gradient(to right, #2ECC71, #2ABA66);
		// background-color: #ff5500;
		font-size: 14px;
		color: #FFFFFF;
		float: right;
		// margin-bottom: 200rpx;
		// position: absolute;
		// left: 460rpx;
		// top: 270rpx;
	}

	.button-yuanjiao2 {
		width: 200rpx;
		height: 50rpx;
		display: flex;
		// margin-top: 0rpx;
		// margin-left: 420rpx;
		line-height: 50rpx;
		justify-content: center;
		border-radius: 25px;
		border: 1px solid #2ECC71;
		// 这里可以改成渐变： 
		// background: linear-gradient(to right, #2ECC71, #2ABA66);
		// background-color: #ff5500;
		font-size: 14px;
		color: #2ECC71;
		margin-left: 245rpx;
		float: left;
		// margin-bottom: 200rpx;
		// position: absolute;
		// left: 460rpx;
		// top: 270rpx;
	}

	.bg-click {
		background-color: #a7a9ff;
	}

	.content-text {
		font-size: 14px;
		color: #666;
		margin-left: 15rpx;
	}
</style>
